<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr = [
            {name:'电脑',price:999,num:10},
            {name:'手机',price:899,num:10},
            {name:'键盘',price:199,num:10},
            {name:'鼠标',price:99,num:10}
        ]
            // arr.forEach(function(item,index,arr){
            //     console.log(item)
            //     console.log(index)
            //     console.log(arr)
            // })
            // var arr1 = arr.map(function(item,index,arr){
            //     return item.price*2
            // })
            // console.log(arr1)
            // var arr2 = arr.filter(function(item,index,arr){
            //     console.log(item)
            //     return item.price > 100
            // })
            // console.log(arr2)
            // var istrue = arr.some(function(item,index,arr){
            //     return item.price > 200
            // })
            // console.log(istrue) //true
            // var istrue1 = arr.every(function(item,index,arr){
            //     return item.price > 200
            // })
            // console.log(istrue1)   //false
            var money = arr.reduce(function(money,item,arr){
                return money+item.price*item.num
            },0)
            console.log(money)
    </script>
</body>
</html>